//
//  LoginViewModel.swift
//  NDAi
//
//  Created by 丸子 on 2024/6/27.
//

import UIKit

class LoginViewModel {
    
    
    func getCode(loginType:Int, phone:String){
        NDProgressHUD.showLoading()
        RequestService.instance.getSendCode(phone, loginType: loginType) {
            NDProgressHUD.showSuccess(title: "提示", subtitle: "获取验证码成功")
        }
    }

    
    func login(loginType:Int, phone:String, code:String) {
        NDProgressHUD.showLoading()
        RequestService.instance.phoneLogin(phone, code: code, loginType: 1, completeClosure: { 
            NDProgressHUD.showSuccess(title: "", subtitle: "登录成功")
        }) { error in
            NDProgressHUD.hide()
        }
    }
    
    
    func deviceLogin() {
        NDProgressHUD.showLoading()
        RequestService.instance.deviceLogin(completeClosure: {
            NDProgressHUD.showSuccess(title: "", subtitle: "登录成功")
        }) { error in
            NDProgressHUD.hide()
        }
    }
    
    
    
    func getUserInfo(){
        RequestService.instance.getUserInfo()
        
    }
}
